\(\color{darkblue}{\textbf{Fundamentals}}\)


\(\color{dodgerblue}{\textbf{Role of Data Scientist}}\)


\(\color{dodgerblue}{\textbf{Modeling is Not Enough}}\)

\(\color{darkblue}{\textbf{Figure Types}}\)


\(\color{dodgerblue}{\textbf{Histogram}}\)

Shows the binned distribution of a continuous variable


\(\color{skyblue}{\textrm{- Basic Plot}}\)

Required: x


\(\color{skyblue}{\textrm{- Aesthetics}}\)

See the section on aesthetics for bar graphs, below


\(\color{skyblue}{\textrm{- Frequency}}\)

Optional: y (which makes it frequency instead of count)


\(\color{dodgerblue}{\textbf{Bar}}\)

\(\color{skyblue}{\textrm{- Absolute Count Bar}}\)

Shows the distribution of a discrete variable

Required: x


\(\color{dodgerblue}{\textbf{Line}}\)

\(\color{darkblue}{\textbf{Axes}}\)


The scale_ functions include whether the axis is _x_ or _y_ and whether the variable plotted is _discrete() or _continuous():

  • scale_x_discrete()
  • scale_y_continuous()


\(\color{dodgerblue}{\textbf{Limiting}}\)

Caution, this will drop data outside of the limits (including bars)


\(\color{dodgerblue}{\textbf{Setting Breaks}}\)

Caution, this will still plot points outside of the range of the breaks leaving the rest of the y axis blank



scales formats:

  • comma
  • percent
  • scientific


\(\color{dodgerblue}{\textbf{Scaling}}\)

\(\color{darkblue}{\textbf{Visuals}}\)


\(\color{dodgerblue}{\textbf{Aesthetics}}\)

Aesthetic Description Values
x x-axis data
y y-axis data
color color of dots, outline of other shapes
fill fill color Same as color
alpha transparency
size diameter of points, thickness of lines
linetype line dash pattern
labels text on a plot or axes see below
shape shape of dot


\(\color{skyblue}{\textrm{- Setting Colors}}\)

Brewer

scale_color_brewer(palette = "Spectral")
scale_fill_brewer(palette = "Spectral")

Manual

scale_color_manual(values = c("color", "color", "color"))
scale_fill_manual(values = c("color", "color", "color"))


\(\color{dodgerblue}{\textbf{Text Location}}\)

\(\color{darkblue}{\textbf{Faceting}}\)


facet_wrap(~)
facet_grid(~)


See section on Patchwork for more

\(\color{darkblue}{\textbf{Patchwork}}\)


\(\color{dodgerblue}{\textbf{Layout}}\)

\(\color{skyblue}{\textrm{- Basic}}\)


\(\color{skyblue}{\textrm{- Setting Columns and Rows}}\)



\(\color{skyblue}{\textrm{- Advanced Layouts}}\)



\(\color{dodgerblue}{\textbf{Visual Settings}}\)

\(\color{skyblue}{\textrm{- Setting Sizes}}\)

heights(row1, row2, . . .)
widths(col1, col2, . . .)


\(\color{skyblue}{\textrm{- Adding Blank Space Between}}\)


\(\color{darkblue}{\textbf{More Tips}}\)